[IA64] rename struct viosapic_rte in order to share VTD code.
authorIsaku Yamahata <yamahata@valinux.co.jp>
Thu, 16 Oct 2008 02:33:05 +0000 (11:33 +0900)
committerIsaku Yamahata <yamahata@valinux.co.jp>
Thu, 16 Oct 2008 02:33:05 +0000 (11:33 +0900)
VTD code uses vioapic_redir_entry structure,
This patch lets viosapci.h use the same structure name and some fields.
That IA64 can use the same VTD code with ia32

Signed-off-by: Anthony xu <anthony.xu@intel.com>
xen/arch/ia64/vmx/viosapic.c
xen/include/asm-ia64/viosapic.h
xen/include/public/arch-ia64/hvm/save.h

index a3cf1865fc49a6c9a04597dd27e6c2b2a2da5a0f..5a9ed27a716ed08afe795908af60c27bc71a3315 100644 (file)
@@ -46,9 +46,9 @@
 
 static void viosapic_deliver(struct viosapic *viosapic, int irq)
 {
-    uint16_t dest = viosapic->redirtbl[irq].dest_id;
-    uint8_t delivery_mode = viosapic->redirtbl[irq].delivery_mode;
-    uint8_t vector = viosapic->redirtbl[irq].vector;
+    uint16_t dest = viosapic->redirtbl[irq].fields.dest_id;
+    uint8_t delivery_mode = viosapic->redirtbl[irq].fields.delivery_mode;
+    uint8_t vector = viosapic->redirtbl[irq].fields.vector;
 
     ASSERT(spin_is_locked(&viosapic->lock));
 
@@ -78,7 +78,7 @@ static int get_redir_num(struct viosapic *viosapic, int vector)
 
     ASSERT(spin_is_locked(&viosapic->lock));
     for ( i = 0; i < VIOSAPIC_NUM_PINS; i++ )
-        if ( viosapic->redirtbl[i].vector == vector )
+        if ( viosapic->redirtbl[i].fields.vector == vector )
             return i;
 
     return -1;
@@ -91,7 +91,7 @@ static void service_iosapic(struct viosapic *viosapic)
 
     while ( (irq = iosapic_get_highest_irq(viosapic)) != -1 )
     {
-        if ( viosapic->redirtbl[irq].trig_mode == SAPIC_LEVEL )
+        if ( viosapic->redirtbl[irq].fields.trig_mode == SAPIC_LEVEL )
             viosapic->isr |= (1UL << irq);
 
         viosapic_deliver(viosapic, irq);
@@ -116,7 +116,7 @@ static void viosapic_update_EOI(struct viosapic *viosapic, int vector)
     if ( !test_and_clear_bit(redir_num, &viosapic->isr) )
     {
         spin_unlock(&viosapic->lock);
-        if ( viosapic->redirtbl[redir_num].trig_mode == SAPIC_LEVEL )
+        if ( viosapic->redirtbl[redir_num].fields.trig_mode == SAPIC_LEVEL )
             gdprintk(XENLOG_WARNING, "redir %d not set for %d EOI\n",
                      redir_num, vector);
         return;
@@ -278,7 +278,7 @@ static void viosapic_reset(struct viosapic *viosapic)
 
     for ( i = 0; i < VIOSAPIC_NUM_PINS; i++ )
     {
-        viosapic->redirtbl[i].mask = 0x1;
+        viosapic->redirtbl[i].fields.mask = 0x1;
     }
     spin_lock_init(&viosapic->lock);
 }
@@ -292,11 +292,11 @@ void viosapic_set_irq(struct domain *d, int irq, int level)
     if ( (irq < 0) || (irq >= VIOSAPIC_NUM_PINS) )
         goto out;
 
-    if ( viosapic->redirtbl[irq].mask )
+    if ( viosapic->redirtbl[irq].fields.mask )
         goto out;
 
     bit = 1UL << irq;
-    if ( viosapic->redirtbl[irq].trig_mode == SAPIC_LEVEL )
+    if ( viosapic->redirtbl[irq].fields.trig_mode == SAPIC_LEVEL )
     {
         if ( level )
             viosapic->irr |= bit;
index 869c284e4fb7390e9624ac38a83eb86aebc73b18..c334ea0c60be5ad5390101e336c0c8fb77ef7623 100644 (file)
@@ -59,7 +59,7 @@ struct viosapic {
     spinlock_t lock;
     struct vcpu * lowest_vcpu;
     uint64_t base_address;
-    union viosapic_rte redirtbl[VIOSAPIC_NUM_PINS];
+    union vioapic_redir_entry redirtbl[VIOSAPIC_NUM_PINS];
 };
 
 void viosapic_init(struct domain *d);
index a2650b591692184d7c48fc8f7be67038fe0929c3..c4c75946ebaf13fb85f4c024eccb16b7e4e75cad 100644 (file)
@@ -106,7 +106,11 @@ DECLARE_HVM_SAVE_TYPE(VTIME, 5, struct hvm_hw_ia64_vtime);
  */
 #define VIOSAPIC_NUM_PINS     48
 
-union viosapic_rte
+/* To share VT-d code which uses vioapic_redir_entry.
+ * Although on ia64 this is for vsapic, but we have to vioapic_redir_entry
+ * instead of viosapic_redir_entry.
+ */
+union vioapic_redir_entry
 {
     uint64_t bits;
     struct {
@@ -124,7 +128,7 @@ union viosapic_rte
 
         uint8_t reserved[3];
         uint16_t dest_id;
-    }
+    } fields;
 };
 
 struct hvm_hw_ia64_viosapic {
@@ -134,7 +138,7 @@ struct hvm_hw_ia64_viosapic {
     uint32_t    pad;
     uint64_t    lowest_vcpu_id;
     uint64_t    base_address;
-    union viosapic_rte  redirtbl[VIOSAPIC_NUM_PINS];
+    union vioapic_redir_entry  redirtbl[VIOSAPIC_NUM_PINS];
 };
 DECLARE_HVM_SAVE_TYPE(VIOSAPIC, 6, struct hvm_hw_ia64_viosapic);